import axios from 'axios';
import { Page } from '@/types/global-business';
import qs from 'query-string';
import { WxAppPageQry, WxAppQry, WxAppView } from '@/types/third/wx-app';

export function fetchWxApp(params: WxAppQry) {
  return axios.get<WxAppView>('/third/wx/app/one', {
    params,
    paramsSerializer: (obj) => {
      return qs.stringify(obj);
    },
  });
}

export function fetchWxAppPage(params: WxAppPageQry) {
  return axios.get<Page<WxAppView>>('/third/wx/app/page', {
    params,
    paramsSerializer: (obj) => {
      return qs.stringify(obj);
    },
  });
}
